import appConfig from '@/config/appConfig.js'

const model = {
	
	changeColors: function() {
		if (appConfig.currentPageType == appConfig.PAGE_TYPE_ENUM.WECHAT_LITE
				|| appConfig.currentPageType == appConfig.PAGE_TYPE_ENUM.WECHAT_H5) {
			initWxpay()
			return '#07C160'
		} else if (appConfig.currentPageType == appConfig.PAGE_TYPE_ENUM.ALIPAY_LITE
				|| appConfig.currentPageType == appConfig.PAGE_TYPE_ENUM.ALIPAY_H5) {
			initAlipay()
			return '#1678FF'
		} else if (appConfig.currentPageType == appConfig.PAGE_TYPE_ENUM.YSFPAY_H5) {
			initYsfpay()
			return '#EF1A1F'
		} else {
			initWxpay()
			return '#07C160'
		}
	}
	
}

// 初始化微信相关
function initWxpay() {
	uni.setNavigationBarColor({
		frontColor: '#ffffff',
		backgroundColor: '#07C160'
	})
}

// 初始化支付宝相关
function initAlipay() {
	uni.setNavigationBarColor({
		frontColor: '#ffffff',
		backgroundColor: '#1678FF'
	})
}

// 初始化云闪付相关
function initYsfpay() {
	uni.setNavigationBarColor({
		frontColor: '#ffffff',
		backgroundColor: '#EF1A1F'
	})
}

export default model